package com.bdqn.config;

import com.bdqn.filter.AuthorizationFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean filterRegist(){
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new AuthorizationFilter());
        registration.setName("AuthorizationFilter");
        registration.addUrlPatterns("/main"); //作为演示，仅仅只限制/main访问
        registration.setOrder(5);
         return registration;
    }
}
